﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using DataAccessLayer;

namespace ServiceLayer.Entity
{
    [DataContract]
    public class UserW
    {
        int userID;
        string userName;
        string password;
        int roleID;


         [DataMember]
        public int UserID
        {
            get { return userID; }
            set { userID = value; }
        }
         [DataMember]
        public string UserName
        {
            get { return userName; }
            set { userName = value; }
        }
         [DataMember]
        public string Password
        {
            get { return password; }
            set { password = value; }
        }
         [DataMember]
        public int RoleID
        {
            get { return roleID; }
            set { roleID = value; }
        }

         public static UserW convert(User user)
         {
             UserW u = new UserW();

             u.UserID = user.UserID;
             u.UserName = user.UserName;
             u.Password = user.Password;
             u.RoleID = user.RoleID;

             return u;

         }

         public static List<UserW> convertList(List<User> list)
         {
             List<UserW> listW = new List<UserW>();

             foreach (User x in list)
             {
                 listW.Add(convert(x));
             }
             return listW;
         }
    }
}